home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
datash1a
/
frmdatas.frm
< prev
next >
Wrap
Text File
|
1999-10-09
|
5KB
|
149 lines
VERSION 5.00
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form frmDataShape
Caption = "Data Shaping Basics"
ClientHeight = 4890
ClientLeft = 60
ClientTop = 345
ClientWidth = 7365
LinkTopic = "Form1"
ScaleHeight = 4890
ScaleWidth = 7365
StartUpPosition = 3 'Windows Default
Begin VB.ListBox List1
Height = 1230
ItemData = "frmDataShape.frx":0000
Left = 480
List = "frmDataShape.frx":0002
TabIndex = 1
Top = 3210
Width = 2445
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSHFlexGrid1
Bindings = "frmDataShape.frx":0004
Height = 2535
Left = 450
TabIndex = 0
Top = 360
Width = 6465
_ExtentX = 11404
_ExtentY = 4471
_Version = 393216
Cols = 5
DataMember = "PhoneNumbers"
_NumberOfBands = 2
_Band(0).Cols = 4
_Band(0).GridLinesBand= 1
_Band(0).TextStyleBand= 0
_Band(0).TextStyleHeader= 0
_Band(0)._NumMapCols= 3
_Band(0)._MapCol(0)._Name= "PhoneNumber"
_Band(0)._MapCol(0)._Caption= "Phone Number"
_Band(0)._MapCol(0)._RSIndex= 0
_Band(0)._MapCol(1)._Name= "Association"
_Band(0)._MapCol(1)._RSIndex= 1
_Band(0)._MapCol(2)._Name= "Name"
_Band(0)._MapCol(2)._RSIndex= 2
_Band(1).BandIndent= 1
_Band(1).Cols = 1
_Band(1).GridLinesBand= 1
_Band(1).TextStyleBand= 0
_Band(1).TextStyleHeader= 0
_Band(1)._ParentBand= 0
_Band(1)._NumMapCols= 2
_Band(1)._MapCol(0)._Name= "Family"
_Band(1)._MapCol(0)._RSIndex= 0
_Band(1)._MapCol(1)._Name= "PhoneNumber"
_Band(1)._MapCol(1)._RSIndex= 1
_Band(1)._MapCol(1)._Hidden= -1 'True
End
Begin VB.Label Label1
Caption = $"frmDataShape.frx":0023
Height = 885
Left = 3330
TabIndex = 2
Top = 3240
Width = 3615
End
End
Attribute VB_Name = "frmDataShape"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim blnLoadingForm As Boolean
'*******************************************************************************************
'* Written by Timothy A. Vanover 10/9/1999
'* This project is meant to explore very basic data shaping, Hierarchical Recordsets.
'* To gain the most of this project you must explore DataEnvironment1 throughly. There are
'* several properties, queries, and relationships, and a connection object that you have
'* to understand to make Hierarchical Recordsets, which the basics are explored here. Also
'* a good look at the Access Database and the table relationship would help gain a good
'* start on "Data Shaping".
'*******************************************************************************************
Private Sub Form_Load()
Dim i As Integer
blnLoadingForm = True 'use to prevent List_Click From firing requery
With MSHFlexGrid1 'set Column widths
.ColWidth(0, 0) = 400
.ColWidth(1, 0) = 1500
.ColWidth(2, 0) = 1500
.ColWidth(3, 0) = 1500
.ColWidth(0, 1) = 1500
End With
With DataEnvironment1
.rsAssociations.Open
If Not .rsAssociations.BOF Then 'check for BOF or EOF before moving
.rsAssociations.MoveFirst
For i = 0 To .rsAssociations.RecordCount - 1
List1.AddItem .rsAssociations!Association 'add record to listbox
If Not .rsAssociations.EOF Then
.rsAssociations.MoveNext 'move to next record
End If
Next i
End If
End With
blnLoadingForm = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
'just a bit of cleanup
With DataEnvironment1
.rsAssociations.Close
.rsPhoneNumbers.Close
.Connection1.Close
End With
Set DataEnvironment1 = Nothing
End Sub
Private Sub List1_Click()
'closing the recordset may not be needed. There is a Filter, and a requery
'I wanted to show the Changing of a named Parameter value which requires
'the recordset to be closed.
If Not blnLoadingForm Then
With DataEnvironment1
.rsPhoneNumbers.Close
.Commands.Item("PhoneNumbers").Parameters("Association").Value = Trim$(List1.Text)
.Commands.Item("PhoneNumbers").Execute
End With
With MSHFlexGrid1
Set .DataSource = Nothing
Set .DataSource = DataEnvironment1
.DataMember = "PhoneNumbers"
End With
End If
End Sub